#include "../Register/apiout.hpp"

int main()
{
	char data[128], username[20], password[20];
	int len;

	system("del /f /s msg.xml");

	p("Content-Type:text/xml\n\n");
	//p("Content-Type:text/html\n\n");

	len = atoi(getenv("CONTENT_LENGTH"));

	if (len == 0)
	{
		InvalidOperation();
		return 0;
	}
	else fgets(data, len + 1, stdin);

	sscanf(data, "username=%[^&]&password=%s", username, password);

	if (ValidLogin(username, password) == true) Success();
	else InvalidUserInfoField();

	return 0;
}